<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>
  <a   onclick="test()">百度</a>
  <script>
    function test()
    {
      //location.href="http://www.baidu.com"
      location.replace("http://www.baidu.com")
    }
    //location.assign('http://www.baidu.com');    // 加载当前目录下的index.html
  </script>
</body>
</html>